<?php
namespace statistics\view\renderers;

use statistics\utils\PHPScriptExecutor;
use statistics\utils\DBAccess;
use statistics\utils\AccessControlManager;
use statistics\view\renderers\ElementRenderer;

require_once(substr(__DIR__, 0, strpos(__DIR__, 'statistics')+10). DIRECTORY_SEPARATOR .'includes.php');


class ErrorPageRenderer extends StandardPageRenderer{
	

	
	public function __construct($pageTitle){
		parent::__construct();				
		$this->pageTitle = $pageTitle;
		$this->pageHeader = '';
		$this->onLoadActions = '';
	}
	
	private function initializePage(){
	
	}
			
	public function renderElement(){
		
		$this->renderedElementHTML .= PHPScriptExecutor::getScriptOutput(SERVER_PATH. '/adm_program/system/overall_header.php');
				
		$this->initializePage();					
 		$this->renderElementContent();				
		
		$this->renderedElementHTML .= $this->generateBackButton();
		
		$this->renderedElementHTML .= PHPScriptExecutor::getScriptOutput(SERVER_PATH. '/adm_program/system/overall_footer.php');
	}
	
	private function generateNotInstalledWarning(){
		$warning = '';
		$warning .= '<p>Das Plugin ist nicht installiert, bitte zuerst installieren.</p>';
		$text = 'Zur Installation';
		$link = STATISTICS_WEB_ROOT.'/view/install.php';
		$warning .= '	<p>
					<form action="'. $link . '" method="post"  >
                		<input type="submit" name="action" value="' . $text . '" />
            		</form>
           	  	</p>';
		return $warning;
	}
	
	private function generateLoginPrivilegesWarning(){
		$warning = '';
		global $gValidLogin;
		if ($gValidLogin) {
			$warning .= '<p>Sie haben keine Berechtigung, diese Seite anzuzeigen.</p>';
		} else {
			$warning .= PHPScriptExecutor::getScriptOutput(SERVER_PATH.'/adm_program/system/login_valid.php');
		}
		return $warning;
	}
	
}

?>